package com.cq.hd.app.config;

import cn.hutool.http.HttpUtil;
import com.cq.hd.common.constant.WxConstant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class WxConfig {

    @Value("${zwx.appId}")
    private String appId;

    @Value("${zwx.appSecret}")
    private String appSecret;

    @Value("${swx.appId}")
    private String swxAppId;

    @Value("${swx.appSecret}")
    private String swxAppSecret;

    public String getOpenIdAndSessionKey(String code) {
        return HttpUtil.get(WxConstant.SNS_JSCODE2SESSION_API.replace("APP_ID", appId).replace("SECRET", appSecret).replace("CODE", code));
    }

}
